home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 8
/
Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO
/
034a
/
ad_d091.arj
/
MASSAGE.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-07-15
|
4KB
|
87 lines
10 REM MASSAGE - Reads the Class and Race .PRN files, and converts them
11 REM into the format required by the AD&D Character Generator program.
12 REM
13 REM Written 6-Jul-1987 by Monte Ferguson, version 1.0
14 REM
20 DEF FNS$(N)=MID$(STR$(N),VAL(MID$("122",SGN(N)+2,1)))
30 DEF FNZPAD$(L,N)=STRING$(L-LEN(FNS$(N)),"0")+FNS$(N)
40 DIM F$(100),T$(100)
100 CLS:COLOR 7,0:KEY OFF
110 PRINT " MASSAGE":PRINT
120 PRINT " This program will convert the .PRN files from the Lotus 1-2-3 worksheets "
130 PRINT "into the file format required by the AD&D Character Generator program."
140 PRINT
150 PRINT " I will assume the source filenames of RACE.PRN and CLASS.PRN, and the target"
160 PRINT "filenames of RACE.DAT and CLASS.DAT. You must tell me the source and target"
170 PRINT "file paths. Omit file names!"
180 PRINT
200 INPUT " Enter Source Filepath (Example: A:\)";SOURCE$
210 IF SOURCE$="" THEN PRINT "Program ends.":END
220 INPUT " Enter Target Filepath (Example: C:\D&D\)";TARGET$
230 IF TARGET$="" THEN PRINT "Program ends.":END
300 CLS
310 PRINT TAB(10);"I will read from:";TAB(50);"and write to:"
320 PRINT TAB(10);STRING$(20,"-");TAB(50);STRING$(20,"-")
330 PRINT TAB(10);SOURCE$+"RACE.PRN";TAB(50);TARGET$+"RACE.DAT"
340 PRINT TAB(10);SOURCE$+"CLASS.PRN";TAB(50);TARGET$+"CLASS.DAT"
350 PRINT:PRINT:PRINT
360 INPUT "Is this correct (Y/N)";YN$
370 IF YN$="y" OR YN$="Y" THEN 400 ELSE IF YN$="n" OR YN$="N" THEN 100 ELSE BEEP:GOTO 300
400 REM Let's do RACE first
410 CLS
420 PRINT "Opening "+SOURCE$+"RACE.PRN...";
430 OPEN SOURCE$+"RACE.PRN" FOR INPUT AS #1:PRINT "Open."
440 PRINT "Opening "+TARGET$+"RACE.DAT...";
450 OPEN "r",#2,TARGET$+"RACE.DAT",256:PRINT "Open."
500 REC=0:F=0
510 DATA 20,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,50,1,1,3,3,3,3,3,30,61,-1
520 RESTORE 510:DUMMY=0
530 READ A:IF A<>-1 THEN F=F+1:FIELD #2,DUMMY AS DUMMY$,A AS F$(F):DUMMY=DUMMY+A:GOTO 530
540 FOR I=1 TO 5:LINE INPUT #1,DUMMY$:NEXT I:REM Tear off the header
550 PRINT "Writing records: ";
600 WHILE NOT EOF(1)
605 LINE INPUT #1,A$
610 T$(1)=MID$(A$,4,20):T$(2)=MID$(A$,24,3)
615 P=29:T$="":F=2
620 M$=MID$(A$,P,1)
625 IF M$=" " THEN IF T$<>"" THEN F=F+1:T$(F)=T$:T$="" ELSE 630 ELSE T$=T$+M$
630 P=P+1:IF P<=LEN(A$) THEN 620
635 IF T$<>"" THEN F=F+1:T$(F)=T$
640 IF F<>68 THEN BEEP:PRINT SOURCE$+"RACE.PRN is corrupt!":STOP
645 Q$="":FOR I=33 TO 60:Q$=Q$+T$(I):NEXT I:Q$=Q$+STRING$(30,"?")
650 T$(33)=Q$:FOR I=34 TO 41:T$(I)=T$(I+27):NEXT I:T$(42)=""
655 FOR I=1 TO 42:LSET F$(I)=T$(I):NEXT I
660 REC=REC+1:PUT #2,REC:PRINT REC;
665 WEND
670 CLOSE #1:CLOSE #2
680 PRINT:PRINT "RACE conversion complete.":PRINT:PRINT
700 REM Now we'll do CLASS
710 PRINT "Opening "+SOURCE$+"CLASS.PRN...";
715 OPEN SOURCE$+"CLASS.PRN" FOR INPUT AS #1:PRINT "Open."
720 PRINT "Opening "+TARGET$+"CLASS.DAT...";
725 OPEN "r",#2,TARGET$+"CLASS.DAT",256:PRINT "Open."
730 REC=0:F=0
735 DATA 15,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1,50,1,128,-1
740 RESTORE 735:DUMMY=0
745 READ A:IF A<>-1 THEN F=F+1:FIELD #2,DUMMY AS DUMMY$,A AS F$(F):DUMMY=DUMMY+A:GOTO 745
750 FOR I=1 TO 5:LINE INPUT #1,DUMMY$:NEXT I:REM Tear off the header
755 PRINT "Writing records: ";
760 WHILE NOT EOF(1)
765 LINE INPUT #1,A$
770 T$(1)=MID$(A$,4,15):T$(2)=MID$(A$,19,3)
775 P=24:T$="":F=2
780 M$=MID$(A$,P,1)
785 IF M$=" " THEN IF T$<>"" THEN F=F+1:T$(F)=T$:T$="" ELSE 790 ELSE T$=T$+M$
790 P=P+1:IF P<=LEN(A$) THEN 780
795 IF T$<>"" THEN F=F+1:T$(F)=T$
800 IF F<>67 THEN BEEP:PRINT SOURCE$+"CLASS.PRN is corrupt!":STOP
805 Q$="":FOR I=39 TO 66:Q$=Q$+T$(I):NEXT I:Q$=Q$+STRING$(22,"?")
810 T$(39)=Q$:T$(40)=T$(67):T$(41)=""
815 FOR I=1 TO 41:LSET F$(I)=T$(I):NEXT I
820 REC=REC+1:PUT #2,REC:PRINT REC;
825 WEND
830 CLOSE #1:CLOSE #2
835 PRINT:PRINT "CLASS conversion complete.":PRINT:PRINT
900 PRINT "All Done!"
999 END